﻿using System;
using System.Linq;
using System.Collections.Generic;
using System.Text;
using WoChu.CF.Version.IFace;
using WoChu.CF.Version.Model;

namespace WoChu.CF.Version
{
    public class UpdateVersion
    {
        private static UpdateVersion _NewInstance = new UpdateVersion();

        public static UpdateVersion NewInstance
        {
            get
            {
                if (_NewInstance == null)
                {
                    _NewInstance = new UpdateVersion();
                }

                return _NewInstance;
            }
        }

        public bool CheckVersion(int majorId, int subId, int buildNo)
        {
            return WoChu.CF.BaseFrame.WebClient.WebGetHelper<IUpdateVersion>.NewInstance.InvokeWebMethod<bool>("CheckVersion", new object[] { majorId, subId, buildNo });
        }

        public VersionInfo GetLastVersion(int majorId, int subId, int buildNo)
        {
            return WoChu.CF.BaseFrame.WebClient.WebGetHelper<IUpdateVersion>.NewInstance.InvokeWebMethod<VersionInfo>("GetLastVersion", new object[] { majorId, subId, buildNo });
        }

        public VersionInfo GetLastVersionForCode(string versionCode)
        {
            return WoChu.CF.BaseFrame.WebClient.WebGetHelper<IUpdateVersion>.NewInstance.InvokeWebMethod<VersionInfo>("GetLastVersionForCode", new object[] { versionCode });
        }
       
    }
}
